package com.example.demo.mapper;

import com.example.demo.model.entity.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {

    @Results(id = "userResult", value = {
            @Result(property = "userName", column = "user_name", id = true),
            @Result(property = "passWord", column = "pass_word"),
    })

    @Select("SELECT * FROM t_user WHERE user_name=#{userName}")
    User findUserByUserName(String userName);

    @Insert("INSERT INTO t_user VALUES (#{userName}, #{passWord}, 0)")
    void register(User user);
}
